#ifndef __CE_ATOMIC_H__
#define __CE_ATOMIC_H__

#include "ce_core.h"

#define ce_cpu_pause()
#define ce_cpu_yield() usleep(1)

typedef long                ce_atomic_t;
#define CE_ATOMIC_T_LEN     (sizeof("-9223372036854775808") - 1)

#define ce_atomic_cmp_set(lock, old, set)                                   \
    __sync_bool_compare_and_swap(lock, old, set)

#define ce_atomic_cmp_set_val(lock, old, set)                               \
    __sync_val_compare_and_swap(lock, old, set)

#define ce_atomic_fetch_add(value, add)                                     \
    __sync_fetch_and_add(value, add)

#endif
